package exp3;
//设电子表格式为24小时制的 HH:MM:SS 输入一个电子表上的时间A,经过时间B后，电子表上显示的时间是多少呢？
import java.util.Scanner;

class Watch{
    int hour;
    int minute;
    int second;

    public Watch(int hour, int minute, int second) {
        this.hour = hour;
        this.minute = minute;
        this.second = second;
        rationalize();
    }

    void rationalize(){
        int temp=0;
        temp = second/60;
        second %=60;
        minute = minute+temp;
        temp = minute/60;
        minute %=60;
        hour =temp+hour;
        hour %=24;
    }

    public Watch add(Watch w){
        int h = this.hour + w.hour;
        int m = this.minute + w.minute;
        int s = this.second + w.second;
        return  new Watch(h,m,s);
    }

    @Override
    public String toString() {
        return String.format("%2d:%2d:%2d",hour,minute,second);
    }
}

public class Time24 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            Watch time = new Watch(in.nextInt(), in.nextInt(), in.nextInt());
            Watch addtime = new Watch(in.nextInt(), in.nextInt(), in.nextInt());
            System.out.println(time.add(addtime));
        }
    }
}
